/*
 * @lc app=leetcode.cn id=9 lang=cpp
 *
 * [9] 回文数
 */

// @lc code=start
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;
/**
 * @brief 将x变y可以只转换一半，y <= x为止，位数为奇数则令x = y/10，偶数救赎x = y
 * 
 */
class Solution {
public:
	bool isPalindrome(int x) {
        if(x < 0 || (x % 10 == 0 && x != 0)) {
			return false;
		} else{
			int x1 = x;
			int y = 0;
			while(x1 > y) {
				int z = x1 % 10;
				y = y * 10 + z;
				x1 /= 10;
			}
			if(x1 == y || x1 == y /10) {
				return true;
			}else {
				return false;
			}
		}
	}
};
// @lc code=end

